package 一些算法竞赛测试题;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-09-26
 * Time: 16:06
 */
public class Demo2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(true){
            int n = scanner.nextInt();
            if(n == 0){
                break;
            }else if(n == 1){
                System.out.println(0);
                continue;
            }else if(n == 2 || n == 3){
                System.out.println(1);
                continue;
            }
            int[] dp = new int[n + 1];
            dp[1] = 0;
            dp[2] = 1;
            dp[3] = 1;
            for(int i = 4; i <= n; i++){
                dp[i] = dp[i - 2] + dp[i - 3];
            }
            System.out.println(dp[n]);
        }
    }
}
